#!/bin/bash

# 生成编译错误影响文件列表脚本
# 用于快速定位和修复编译错误

echo "=== 编译错误影响文件列表 ==="
echo "生成时间: $(date)"
echo ""

# 高优先级错误文件 (编译错误)
echo "### 高优先级错误文件 (编译错误) ###"
echo ""

# 变量未定义错误文件
echo "## 1. 变量未定义错误文件:"
error_files=(
    "fuint-application/src/main/java/com/fuint/common/service/impl/UserCouponServiceImpl.java"
    "fuint-application/src/main/java/com/fuint/common/service/impl/GiveServiceImpl.java"
    "fuint-application/src/main/java/com/fuint/common/service/impl/CommissionRelationServiceImpl.java"
    "fuint-application/src/main/java/com/fuint/common/service/impl/BalanceServiceImpl.java"
    "fuint-application/src/main/java/com/fuint/common/service/impl/PointServiceImpl.java"
    "fuint-application/src/main/java/com/fuint/common/service/impl/SmsTemplateServiceImpl.java"
    "fuint-application/src/main/java/com/fuint/common/service/impl/BookItemServiceImpl.java"
    "fuint-application/src/main/java/com/fuint/common/service/impl/MemberServiceImpl.java"
    "fuint-application/src/main/java/com/fuint/common/service/impl/OpenGiftServiceImpl.java"
    "fuint-application/src/main/java/com/fuint/common/service/impl/CommissionCashServiceImpl.java"
    "fuint-application/src/main/java/com/fuint/common/service/impl/CommissionLogServiceImpl.java"
)

for file in "${error_files[@]}"; do
    if [ -f "$file" ]; then
        echo "✓ $file (存在)"
    else
        echo "✗ $file (不存在)"
    fi
done

echo ""
echo "## 2. 类型不兼容错误文件:"
type_error_files=(
    "fuint-application/src/main/java/com/fuint/common/service/impl/SendSmsServiceImpl.java"
    "fuint-application/src/main/java/com/fuint/common/service/impl/BannerServiceImpl.java"
    "fuint-application/src/main/java/com/fuint/common/service/impl/UserActionServiceImpl.java"
)

for file in "${type_error_files[@]}"; do
    if [ -f "$file" ]; then
        echo "✓ $file (存在)"
    else
        echo "✗ $file (不存在)"
    fi
done

echo ""
echo "## 3. 数据类型转换错误文件:"
conversion_error_files=(
    "fuint-application/src/main/java/com/fuint/common/service/impl/UserCouponServiceImpl.java"
    "fuint-application/src/main/java/com/fuint/common/service/impl/SmsTemplateServiceImpl.java"
    "fuint-application/src/main/java/com/fuint/common/service/impl/OrderServiceImpl.java"
)

for file in "${conversion_error_files[@]}"; do
    if [ -f "$file" ]; then
        echo "✓ $file (存在)"
    else
        echo "✗ $file (不存在)"
    fi
done

echo ""
echo "### 中优先级警告文件 ###"
echo ""

warning_files=(
    "fuint-utils/src/main/java/com/fuint/utils/ArrayUtil.java"
    "fuint-application/src/main/java/com/fuint/common/config/RedisConfig.java"
    "fuint-application/src/main/java/com/fuint/common/config/SecurityConfig.java"
)

for file in "${warning_files[@]}"; do
    if [ -f "$file" ]; then
        echo "✓ $file (存在)"
    else
        echo "✗ $file (不存在)"
    fi
done

echo ""
echo "=== 统计信息 ==="
echo "编译错误文件总数: 15个"
echo "警告文件总数: 3个"
echo "总影响文件数: 18个"

echo ""
echo "=== 修复建议 ==="
echo "1. 优先修复编译错误文件 (15个)"
echo "2. 检查分页相关的变量定义和引用"
echo "3. 统一分页框架的使用"
echo "4. 处理类型转换问题"
echo "5. 最后处理警告文件"

echo ""
echo "=== 快速检查命令 ==="
echo "检查编译状态: cd fuintBackend && mvn clean compile"
echo "查看详细错误: cd fuintBackend && mvn clean compile -X"
